###############################################################################
# Variable definitions for targets to build
###############################################################################
#___INFO__MARK_BEGIN__
##########################################################################
#
#  The Contents of this file are made available subject to the terms of
#  the Sun Industry Standards Source License Version 1.2
#
#  Sun Microsystems Inc., March, 2001
#
#
#  Sun Industry Standards Source License Version 1.2
#  =================================================
#  The contents of this file are subject to the Sun Industry Standards
#  Source License Version 1.2 (the "License"); You may not use this file
#  except in compliance with the License. You may obtain a copy of the
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
#  Software provided under this License is provided on an "AS IS" basis,
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
#  See the License for the specific provisions governing your rights and
#  obligations concerning the Software.
#
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
#  Copyright: 2001 by Sun Microsystems, Inc.
#
#  All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
GDILIB_DIR = $(SDIR)/libs/gdi

GDILIB = libgdi$(LIBEXT)

GDILIB_SRC = pack_job_delivery.c \
             sge_gdi_ctx.c \
             sge_gdi2.c \
             sge_gdi_packet.c \
             sge_gdi_packet_internal.c \
             sge_gdi_packet_pb_cull.c \
             sge_qexec.c \
             qm_name.c \
             sge_security.c \
             sge_qtcsh.c \
             version.c

GDILIB_OBJS = $(GDILIB_SRC:.c=.o)

###############################################################################
# global rules: all, clean, depend, messages
###############################################################################
gdilib: $(GDILIB)

gdilib_clean:
		$(RM) $(GDILIB_OBJS) libgdi.a libgdi$(SHAREDEXT)

gdilib_depend:
		$(DEPEND) -f$(GDILIB_DIR)/gdi_dependencies $(GDILIB_DIR)/*.c

gdilib_messages:
	@echo Creating $@
	@for i in `ls $(GDILIB_DIR)/*.c`; do \
	   $(CC) $(CFLAGS) -DEXTRACT_MESSAGES -E $$i | $(XGETTEXT) - ;\
	done

###############################################################################
# rules to build library
###############################################################################
libgdi.a:	$(GDILIB_OBJS) 
	$(AR) $(ARFLAGS) libgdi.a $(GDILIB_OBJS)
	$(RANLIB) libgdi.a

libgdi$(SHAREDEXT): $(GDILIB_OBJS) $(SGEOBJDLIB) $(COMMLIB) $(COMMLISTSLIB) $(CULLLIB) $(UTILIB) 
	$(SHAREDLD) $(SHARED_LFLAGS) -o libgdi$(SHAREDEXT) $(GDILIB_OBJS) -lsgeobjd -lcomm -lcommlists -lcull -luti $(LIBS) -lc

###############################################################################
# include dependencies for object files generated by sge_depend
###############################################################################
include $(GDILIB_DIR)/gdi_dependencies

###############################################################################
# rules to build object codes
###############################################################################
version.o:	$(GDILIB_DIR)/version.c
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/version.c

sge_qexec.o:	$(GDILIB_DIR)/sge_qexec.c
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_qexec.c

sge_gdi2.o:	$(GDILIB_DIR)/sge_gdi2.c
		$(CC) -o $@ $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_gdi2.c
		
sge_gdi_packet.o:	$(GDILIB_DIR)/sge_gdi_packet.c
		$(CC) -o $@ $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_gdi_packet.c
		
sge_gdi_packet_internal.o:	$(GDILIB_DIR)/sge_gdi_packet_internal.c
		$(CC) -o $@ $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_gdi_packet_internal.c
		
sge_gdi_packet_pb_cull.o:	$(GDILIB_DIR)/sge_gdi_packet_pb_cull.c
		$(CC) -o $@ $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_gdi_packet_pb_cull.c
		
sge_gdi_ctx.o:	$(GDILIB_DIR)/sge_gdi_ctx.c
		$(CC) -o $@ $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_gdi_ctx.c
		
pack_job_delivery.o:	$(GDILIB_DIR)/pack_job_delivery.c
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/pack_job_delivery.c

qm_name.o: 	$(GDILIB_DIR)/qm_name.c
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/qm_name.c

sge_security.o: $(GDILIB_DIR)/sge_security.c 
		$(CC) $(CFLAGS) $(NOERR_CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_security.c

sge_qtcsh.o: $(GDILIB_DIR)/sge_qtcsh.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(GDILIB_DIR)/sge_qtcsh.c

#---------------------------------------------------------------------
# test programs
